#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
#define MAX 999

int main()
{
pid_t pid1, pid2;

pid1 = fork();
if(pid1<0) 
{
fprintf(stderr,"Fork basarisiz");
exit(-1);
}
else if (pid1 ==0)/*child prosesleri*/
{


printf("d\n");

execlp("./d","d",NULL); //./d는 prompt 소스코드
execlp("./d1","d1",NULL); 
}
else /*parent procsesleri */
{
wait(NULL);
pid2 = fork();
if(pid2<0) 
{
fprintf(stderr,"Fork basarisiz");
exit(-1);
}
else if (pid2 ==0)/*child prosesleri*/
{
printf("\n");
printf("d1\n");
printf("\n");
execlp("./d1","d1",NULL);
//printf("\n");
}
else
{
}

/////////////////////////////////////////////////////////////////////////
wait(NULL);
printf("\n");
printf("Parent:Two child processes have successfully been created\n");
printf("Parent:Two child processes have successfully been terminated\n");
printf("Parent:This process will now terminate\n");
printf("\n");
exit(0);
}
}
